/*
 * @: 
 * @version: 1.0
 * @Author: ziwei
 * @Date: 2021-10-18 23:56:08
 * @LastEditors: ziwei
 * @LastEditTime: 2021-10-21 22:46:02
 */
import * as actionTypes from '../action-types'
//counter1 组件对应的state
let intialState ={number:0,color:"black"}
//counter1对应的reducer
function counter2(state =intialState, action) {
    switch (action.type) {
        case actionTypes.ADD2:
            return {
                number: state.number + 1
            };
        case actionTypes.MINUS2:
            return {
                number: state.number - 1
            };
        case actionTypes.CHANGE_COLOR:
            return {
                ...state,color: action.payload
            }
            default:
                return state;
    }
}
export default counter2